import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


public class Test {

	public static void main(String[] args) {
		//Animal a = new Animal("A", 1, 2.9);  <<< rabotatj ne budet izza abstractnogo metoda
		// v skobkah parametry konstruktora
		Cat cat = new Cat("Cat1", 2, 23.5);
		Animal cat2 = new Cat("Cat2", 3, 27.5);
		Dog dog = new Dog("Dog1", 3, 27.5);
		Duck duck = new Duck("Duck1", 1, 9.99);
		
		// konteiner dlja hranennija Animals
		List<Animal> list = new ArrayList<Animal>();
		list.add(cat);
		list.add(cat2);
		list.add(dog);
		list.add(duck);
		
		System.out.println("General activities (inheritance from an abstract class):\n");
		for (Animal a : list) {
			System.out.println("My name is " + a.name);
			a.move();
			a.say();
			System.out.println();
		}
		
		System.out.println("Individual activities (implementation of interfaces):\n");
		cat.jump();
		cat.run();
		dog.run();
		duck.fly();
		
		// sortirovka po "pravilam"
		System.out.println("Objects sorting (with a comparator):\n");
		// sortirovka po princypu ceny
		Collections.sort(list, new AnimalPriceComparator());
		for (Animal a : list) {
			System.out.println(a.name + " " + a.price);
		}
		
		
	}
	
}
